<?php

require_once PATH_CLASS.'commun.class.php';
require_once PATH_CLASS.'security.class.php';

class manageNews extends form {
  var $params = array();
  public function getDefaults() {
    $ret = parent::getDefaults();
    $ret = array_merge($ret,array(
       'isLoggued'  => commun::isLogged()
      ,'membre'     => commun::getLoggedMembre()
    ));
    return $ret;
  }
  
  public function isAuthorized() {
    $ret = security::canPostNews() || security::canUpdateNews();
    return $ret;
  }  
  
  public function __construct($params) {
    //parent::__construct($params);

    $this->params = array_merge($this->getDefaults(),$params);
    
    if(!$this->isAuthorized()){
      throw new Exception("Non authorisé");
    }
  }
  
}

